const fs = require('fs');
const path = require('path');
const client = require('scp2');


// Configure server connection information
const server = {
    host: '120.48.63.39',
    port: '22',
    username: 'root',
    password: 'Jsz!0400530119'
};

// Configure local folder path and server target path
const localFolderPath = path.resolve(__dirname, '../../public/');
const serverFolderPath = '/root/www/apps/node/';

client.scp(localFolderPath, {
    host: server.host,
    username: server.username,
    password: server.password,
    path: serverFolderPath
}, function (err) {
    if(err){
        console.error('Error uploading err:', err);
    }
    else{
        console.log("upload success")
    }
    
})
